<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('waiting')} > ${i18n.getMessage('search')}"></@showTitle>

<form action="program/searchWaiting.sgt" onsubmit="submitForm(this); return false;">
	<table id="dataTable" align="center" cellpadding="0" cellspacing="5">
		<tr> 
			<td class="name">${i18n.getMessage('program')}:</td>
			<td>
				<select id="programId" name="programId" style="width:204px">
					<option></option>
					<#list programs as program>
						<option value="${program.id}" <#if (searchProgram.id + '')! == (program.id + '')>selected</#if>>${program.name}</option>
					</#list>
				</select> <span id="progressMsg" class="indicator" style="display: none;">&nbsp;Loading...</span>
			</td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('level')}:</td>
			<td>
				<select id="levelId" name="levelId" style="width:205px">
					<option></option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('fromRegisteredDate')}: </td>
			<td><input type="text" name="fromRegisteredDate" value="${(searchWaiting.fromTestDate?date)!}" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].fromRegisteredDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('toRegisteredDate')}: </td>
			<td><input type="text" name="toRegisteredDate" value="${(searchWaiting.toTestDate?date)!}" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].toRegisteredDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('studentType')}:</td>
			<td>
				<select name="typeId" style="width:204px">
					<option></option>
					<#list types as type>
						<option value="${(type.id)!}">${(type.name)!}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('Consultant')}:</td>
			<td>
				<select name="consultantId" style="width:204px">
					<option></option>
					<optgroup label="Active">
						<#list consultants as consultant>
							<#if consultant.active>
								<option value="${(consultant.id)!}" style="<@formatOnConsultant consultant/>">${(consultant.fullName)!}</option>								
							</#if>
						</#list>					
					</optgroup>
					<optgroup label="Inactive">
						<#list consultants as consultant>
							<#if !consultant.active>
								<option value="${(consultant.id)!}" style="<@formatOnConsultant consultant/>">${(consultant.fullName)!}</option>								
							</#if>
						</#list>					
					</optgroup>
				</select>
			</td>
		</tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" value="${i18n.getMessage('search')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>
<@ajax.select baseUrl="programlevelsearch.view" source="programId" target="levelId"
	parameters="programId={programId}" preFunction="initProgress"
	postFunction="resetProgress" errorFunction="reportError" />